#!/usr/bin/env python3.6
# -*- coding:utf-8 -*-

from pywinauto.application import Application
from pywinauto.base_wrapper import ElementNotEnabled
from pywinauto.findwindows import ElementNotFoundError

# import config
# conf = config.CONF()

if __name__ == "__main__":
	app = Application().connect(title_re="Xshell 5", class_name="Xshell::MainFrame_0")
	win = app.window(title='Xshell 5')
	try:
		win.type_keys('%F%N')
	except ElementNotEnabled as err:
		print("ElementNotEnabled")
	finally:
		print("Finish!")
	# win.print_control_identifiers()

	try:
		create_session_win = app.window(title='新建会话属性', class_name="#32770 (Dialog)")
		create_session_win.type_keys('%{F4}')
	except ElementNotFoundError as err:
		print("ElementNotFoundError")
	finally:
		print("Finish!")
	# create_session_win.print_control_identifiers()
	# create_session_win[''].set_text();

	input("pause")
